package pl.perseus.action;

import lombok.Getter;
import lombok.Setter;

import org.springframework.beans.factory.annotation.Autowired;

import pl.perseus.model.Degree;
import pl.perseus.service.degree.IDegreeService;

public class CreateStudentDegreeAction extends BaseAction {

	@Autowired
	IDegreeService degreeService;
	
	@Getter
	@Setter
	Degree degree;
	
	@Getter
	@Setter
	String degreevalue;
	
	@Override
	public String execute() {
		Double val = Double.parseDouble(degreevalue);
		degree.setDegreevalue(val);
		degree.setActive(true);
		degreeService.insertDegree(degree);
		logAction("Adding grade " + degree.getDegreename() + " " + degreevalue);
		return SUCCESS;
	}

}
